//  This file is part of Swordbible - http://www.swordwarrior.net
//  Copyright (C) 2003-2009 Manu Mital mital.manu@gmail.com

//  This program is free software; you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation; either version 2, or (at your option)
//  any later version.

//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.

//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software Foundation,
//  Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.



#include <StdAfx.h>
#include ".\SwordBiblefonts.h"


CString CSwordBibleFonts::strong_color ;
CString CSwordBibleFonts::morph_color;
CString CSwordBibleFonts::fn_color;


CSwordBibleFonts::CSwordBibleFonts(void)
{
	
}

CSwordBibleFonts::~CSwordBibleFonts(void)
{
}

void CSwordBibleFonts::Load()
{	
	strong_color =		AfxGetApp()->GetProfileString(_T("AFX_TAGSCOLOR"), _T("strong_color"), _T("\\red128\\green0\\blue0"));
    morph_color =     AfxGetApp()->GetProfileString(_T("AFX_TAGSCOLOR"), _T("morph_color"),  _T("\\red0\\green0\\blue160"));
	fn_color =     AfxGetApp()->GetProfileString(_T("AFX_TAGSCOLOR"), _T("fn_color"), _T("\\red0\\green0\\blue160"));

	CString Section = _T("");

	if(location == AFX_MAINBIBLE)
	 Section	= _T("BiblePage");

	else if(location == AFX_BOTTOM)
		Section = _T("Bottom");

	else if(location == AFX_BOTTOMLEFT)
		Section = _T("BottomLeft");

		else if(location == AFX_DEVOTIONAL)
		Section = _T("Devotional");

		else if(location == AFX_GENBOOKS)
			Section = _T("GenBooks");

	
	text_facename =		AfxGetApp()->GetProfileString(Section, _T("text_facename"), _T("Arial"));
    text_facesize =     AfxGetApp()->GetProfileInt(Section, _T("text_facesize"), 22);
	text_color =        AfxGetApp()->GetProfileString(Section, _T("text_color"), _T("\\red0\\green0\\blue0"));
	verse_color =       AfxGetApp()->GetProfileString(Section, _T("verse_color"), _T("\\red0\\green128\\blue128"));
	links_color =       AfxGetApp()->GetProfileString(Section,_T("links_color"), _T("\\red0\\green128\\blue128"));
	bg_color    =       AfxGetApp()->GetProfileString(Section, _T("bg_color"),_T("\\red255\\green255\\blue255") );

}



void CSwordBibleFonts::ConstructRTF()
{
	rtf_header.Format(   _T("{\\rtf1{\\colortbl;  %s; %s;  %s; %s;  %s; %s; %s; %s; %s; %s; %s;}{\\fonttbl {\\f1 %s;} {\\f2 %s;}}\\f1\\fs%d "),
		verse_color,   //cf1 - color of the verse number in the main bible window
		text_color,    //cf2 - color of the text (sentences) associated with a verse in main bible window
		strong_color,  //cf3 - color of the lemma tags (strong's numbers)
		morph_color,   //cf4 - color of the morphological tags(e.g. Robinson or Thayer)
		fn_color,      //cf5 - color of the text for the footnotes 
		links_color,   //cf6 - color of scripture references
		_T("\\red0\\green0\\blue0"), //cf7 - color of the verse number in the tooltip window 
		_T("\\red0\\green0\\blue0"),  //cf8 - color of the text (sentences) associated with a verse in tooltip window
		_T("\\red255\\green0\\blue0"),  // cf9 - red  Parallel Bible1
		_T("\\red0\\green0\\blue255"),  // cf10 - blue Parallel Bible2
		_T("\\red0\\green0\\blue0"),  // cf11 - green Parallel Bible3
		text_facename,  //f1  - name of font (such as Arial or Verdana) in the main bible window
		text_facename,//f2  - name of font (such as Arial or Verdana) in the tooltip window
		text_facesize);  // text size in half-points

	
}





void CSwordBibleFonts::Save()
{

	AfxGetApp()->WriteProfileString(_T("AFX_TAGSCOLOR"), _T("strong_color"), strong_color);
   AfxGetApp()->WriteProfileString(_T("AFX_TAGSCOLOR"), _T("morph_color"),  morph_color);
   AfxGetApp()->WriteProfileString(_T("AFX_TAGSCOLOR"), _T("fn_color"),  fn_color);

	CString Section = _T("");

		if(location == AFX_MAINBIBLE)
	 Section	= _T("BiblePage");

	else if(location == AFX_BOTTOM)
		Section = _T("Bottom");

	else if(location == AFX_BOTTOMLEFT)
		Section = _T("BottomLeft");

		else if(location == AFX_DEVOTIONAL)
		Section = _T("Devotional");

		else if(location == AFX_GENBOOKS)
			Section = _T("GenBooks");

	AfxGetApp()->WriteProfileString(Section, _T("text_facename"), text_facename);
    AfxGetApp()-> WriteProfileInt(Section, _T("text_facesize"), text_facesize);
	AfxGetApp()->WriteProfileString(Section, _T("text_color"), text_color);
	AfxGetApp()->WriteProfileString(Section, _T("verse_color"), verse_color);
	AfxGetApp()->WriteProfileString(Section,_T("links_color"), links_color);
	AfxGetApp()->WriteProfileString(Section, _T("bg_color"), bg_color);

		
	 	
}
